
#pragma once

//#include "libden/meta/is_stl_compatible.h"

//#include "libden/meta/support_same.h"

#if defined(__GNUC__) || defined(__MINGW__) || defined(__MINGW32__)
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Weffc++"
#endif


namespace Den{

#if 0
    class MyIterator : public std::iterator<std::input_iterator_tag, int>
    {
        int* p;
    public:
        MyIterator(int* x) :p(x) {}
        MyIterator(const MyIterator& mit) : p(mit.p) {}
        MyIterator& operator++() {++p;return *this;}
        MyIterator operator++(int) {MyIterator tmp(*this); operator++(); return tmp;}
        bool operator==(const MyIterator& rhs) {return p==rhs.p;}
        bool operator!=(const MyIterator& rhs) {return p!=rhs.p;}
        int& operator*() {return *p;}
    };
#endif

    namespace detail_iterator{
    }//namespace detail_iterator


    template<class ConstIterator> struct BuildIterator: ConstIterator
    {
        typedef typename ConstIterator::value_type
            value_type;

        template<class T> BuildIterator(T& a):ConstIterator(a){}
        template<class T1,class T2> BuildIterator(T1& a1, T2& a2):ConstIterator(a1,a2){}
        template<class T1,class T2> BuildIterator(T1& a1, T2& a2):ConstIterator(a1,a2){}jj

        BuildIterator& operator++()
            { ++static_cast<ConstIterator&>(*this); return *this; }
        BuildIterator operator++(int) 
            { BuildIterator tmp(*this); operator++(); return tmp;}

        bool operator!=(const BuildIterator& rhs)const
        { 
            const auto& me = static_cast<const ConstIterator&>(*this);
            const auto& rh = static_cast<const ConstIterator&>(*rhs);
            return me!=rh;
        }
        bool operator==(const BuildIterator& rhs)const
        {
            const auto& me = static_cast<const ConstIterator&>(*this);
            const auto& rh = static_cast<const ConstIterator&>(*rhs);
            return me==rh;
        }
        value_type& operator*() 
        {
            const auto& me = static_cast<const ConstIterator&>(*this);
            const auto& re = *me;
            return const_cast<value_type&>(re);
        }
        value_type* operator->() 
        {
            const auto& me = static_cast<const ConstIterator&>(*this);
            const auto* re = me.operator->();
            return const_cast<value_type*>(re);
        }
    };


}//namespace Den



#if defined(__GNUC__) || defined(__MINGW__) || defined(__MINGW32__)
    #pragma GCC diagnostic pop
#endif

